#ifndef PLANET_HH_
# define PLANET_HH_
# include "World.hh"
# include "Player.hh"
# include "Star.hh"
# include <boost/noncopyable.hpp>

class World::Planet: boost::noncopyable {
    public: class Task;                 QSP(Task);
    public: class  BuildDwelling;       QSP(BuildDwelling);
    public: class  BuildFactory;        QSP(BuildFactory);
    public: class  BuildFarm;           QSP(BuildFarm);
    public: class  BuildReactor;        QSP(BuildReactor);
    public: class  BuildBattleship;     QSP(BuildBattleship);
    public: class  BuildFighter;        QSP(BuildFighter);
    public: class  BuildTransportship;  QSP(BuildTransportship);
    public: class  BuildColonyship;     QSP(BuildColonyship);
    public: class  BuildTank;           QSP(BuildTank);
    public: class  BuildProducts;       QSP(BuildProducts);

    public: static spPlanet construct(u1 id, spStar star);

    protected: mutable QMutex lock;

    /**
     * \brief Azonosító, amely egyben a csillagtól való távolság is.
     */
    public: u1 const id;

    protected: wpStar const star;

    protected: wpPlayer owner;

    protected: QVector< spTask > buildQueue;

    /**
     * \brief A bolygó mérete.
     *
     * Maximum ennyi épület építhető.
     */
    protected: u8 size;

    /**
     * \brief Népesség.
     */
    protected: u8 population;

    /**
     * \brief Raktározott élelem.
     */
    protected: u8 food;

    protected: u8 dwelling;

    protected: u8 factory;

    protected: u8 farm;

    protected: u8 reactor;

    protected: u8 fighter;

    protected: u8 tank;

    protected: Planet(u1 id, spStar star);

    public: void next_turn();

    public: bool build_colony(spPlayer builder);
    public: bool attack(spFleet attacker);

    protected: u8 food_production()     const;
    protected: u8 industry_production() const;

    protected: f8 dwelling_rate() const;
    protected: f8 energy_rate()   const;
    protected: f8 food_rate()     const;
    protected: f8 worker_rate()   const;

    public: spStar   get_star()       const;
    public: spPlayer get_owner()      const;
    public: QVector<spTask> get_tasks() const;
    public: u8       get_size()       const;
    public: u8       get_population() const;
    public: u8       get_food()       const;
    public: u8       get_dwelling()   const;
    public: u8       get_factory()    const;
    public: u8       get_farm()       const;
    public: u8       get_reactor()    const;
    public: u8       get_fighter()       const;
    public: u8       get_tank()    const;

    public: void add_task(Task* task);
    public: void add_task(spTask task);
    public: void del_task(u8 idx);

    public: void add_dwelling(i8 value);
    public: void add_factory(i8 value);
    public: void add_farm(i8 value);
    public: void add_reactor(i8 value);
    public: void add_fighter(i8 value);
    public: void add_tank(i8 value);
};

# include "Planet/Task.hh"

#endif // ndef PLANET_HH_
